package com.hlw.hr_man.daoImpl;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import com.hlw.hr_man.dao.UpdateDeptDao;
import com.hlw.hr_man.util.JDBCUtil;

public class UpdateDeptDaoImpl implements UpdateDeptDao{

	@Override
	public int updateDept(String dept_name, String dept_describe, String dept_createtime,String dept_id) {
		int flag = 0;
		Connection con = JDBCUtil.getConnection();
		StringBuffer sql = new StringBuffer("update hr_department set dept_name=?,dept_describe=?,dept_createtime=? where dept_id=?");
		try {
			PreparedStatement pst = con.prepareStatement(sql.toString());
			pst.setString(1,dept_name);
			pst.setString(2,dept_describe);
			pst.setString(3,dept_createtime);
			pst.setString(4,dept_id);
			int i = pst.executeUpdate();
			if(i>0){
				flag = 1;
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return flag;
	}

}
